<?php

namespace Drupal\shushengyuan\Schemas;

use Drupal\shusy_errand\Entity\ShusyErrandOrder;

/**
 * @OA\Schema(
 *   schema="ErrandOrderInfo",
 *   type="object",
 *   description="ErrandOrderInfo",
 *   allOf={
 *       @OA\Schema(ref="#/components/schemas/ErrandOrder"),
 *   }
 * )
 */
class ErrandOrderInfo extends ErrandOrder {

  protected function setValue() {
    parent::setValue();
    if ($this->entity instanceof ShusyErrandOrder) {
      $value = [
        /**
         * @OA\Property(
         *   property="order",
         *   type="object",
         *   description="订单信息",
         *   ref="#/components/schemas/OrderInfo",
         * ),
         */
        'order' => OrderInfo::get($this->entity->store_order_id),
      ];
      $this->merge($value);
    }
  }
}
